package cn.gcyl.module.biz.dal.mysql.columntype;

import java.util.*;

import cn.gcyl.framework.common.pojo.PageResult;
import cn.gcyl.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.gcyl.framework.mybatis.core.mapper.BaseMapperX;
import cn.gcyl.module.biz.dal.dataobject.columntype.ColumnTypeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.gcyl.module.biz.controller.admin.columntype.vo.*;

/**
 * 栏目类型 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ColumnTypeMapper extends BaseMapperX<ColumnTypeDO> {

    default PageResult<ColumnTypeDO> selectPage(ColumnTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ColumnTypeDO>()
                .eqIfPresent(ColumnTypeDO::getColumns, reqVO.getColumns())
                .likeIfPresent(ColumnTypeDO::getColumnName, reqVO.getColumnName())
                .eqIfPresent(ColumnTypeDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ColumnTypeDO::getCategory, reqVO.getCategory())
                .eqIfPresent(ColumnTypeDO::getRegistrationFields, reqVO.getRegistrationFields())
                .betweenIfPresent(ColumnTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ColumnTypeDO::getId));
    }
    default List<ColumnTypeDO> getAppColumnTypeList(ColumnTypePageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ColumnTypeDO>()
                .eqIfPresent(ColumnTypeDO::getColumns, reqVO.getColumns())
                .likeIfPresent(ColumnTypeDO::getColumnName, reqVO.getColumnName())
                .eqIfPresent(ColumnTypeDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ColumnTypeDO::getCategory, reqVO.getCategory())
                .eqIfPresent(ColumnTypeDO::getRegistrationFields, reqVO.getRegistrationFields())
                .betweenIfPresent(ColumnTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ColumnTypeDO::getId));
    }

}